package huxibianjie.com.lbscandroid;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;

import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;

import huxibianjie.com.lbscandroid.manager.UserManager;
import huxibianjie.com.lbscandroid.util.CrashHandler;
import huxibianjie.com.lbscandroid.util.MyLog;

/**
 * Created by Administrator on 2016/10/21.
 */

public class MyApplication extends Application {

    @SuppressLint("StaticFieldLeak")
    private static Context context;

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        MobclickAgent.setDebugMode(BuildConfig.DEBUG);//开启调试模式（如果不开启debug运行不会上传umeng统计）
        MobclickAgent.openActivityDurationTrack(false);
        //设置LOG开关，默认为false
        UMConfigure.setLogEnabled(BuildConfig.DEBUG);
        MyLog.TAG = BuildConfig.DEBUG ? MyLog.openAll : -1;
        UserManager.getInstance().init(getContext());
        CrashHandler.getInstance().init(this);
        //初始化组件化基础库, 统计SDK/推送SDK/分享SDK都必须调用此初始化接口
        UMConfigure.init(this, "5b3b2f0df29d98597900005a", "Umeng", UMConfigure.DEVICE_TYPE_PHONE,
                null);
        MobclickAgent.setScenarioType(getApplicationContext(), MobclickAgent.EScenarioType.E_UM_NORMAL);
    }

    public static Context getContext() {
        return context;
    }


}
